package com.next.muscu.visual;

import java.awt.Component;

import javax.swing.DefaultListCellRenderer;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.ListCellRenderer;

import com.next.muscu.data.ExoType;

public class ExoTypeJlistCellRender extends DefaultListCellRenderer implements
		ListCellRenderer {

	@Override
	public Component getListCellRendererComponent(JList arg0, Object arg1,
			int arg2, boolean arg3, boolean arg4) {
		JLabel c = (JLabel) super.getListCellRendererComponent(arg0, arg1,
				arg2, arg3, arg4);
		if (arg1 != null) {
			if (arg1.getClass().equals(ExoType.class)) {
				ExoType e = (ExoType) arg1;
				c.setText(e.getCode() + " : " + e.getName());
			} else
				c.setText(arg1.toString());
		}
		return c;
	}
}
